1. Technical Field
The present invention relates generally to the field of computer software and, more specifically, to object oriented systems.
2. Description of Related Art
Computers have come to permeate all aspects of society since the introduction of the personal computer over twenty years ago. During this time, computers and computer programming languages have evolved to allow greater control of and manipulation of information. Originally, most software was written in unstructured programming languages. Later, other programming languages developed, such as procedural and modular programming languages, that allowed programmer greater flexibility in creating software and allowed for the creation of more complex software that resulted in a greater simplicity of use for the end user. Currently, one of the more popular and powerful programming language types is object-oriented programming, such as, for example, Java and C++.
An object-oriented program is made up of objects. An object has an internal state (i.e. variables that are local to the object) and operations to modify that state. This is unlike previous programming systems, such as procedural and modular systems in which the software contained sub-procedures or modules called by a main routine, where the variables that are to be modified must be passed from one routine to the sub-routine in a predefined format and are globally modified. In the everyday world that most of us are familiar with, an example of an object is a car. It has an internal state consisting of ‘amount of fuel’, ‘make of car’, ‘number of miles driven’ and ‘color’ and it responds to the operations ‘drive n miles’, ‘how many miles have you driven?’ and ‘respray with color c’. Similarly, software objects have an internal state. Where relevant, objects know how to display themselves on the screen and how to load and save themselves.
Every object is an instance of (i.e. belongs to) a class. In simple terms a class is just a template for the object. It contains details of all the behavior of an object along with what state information the object has (i.e. it has the code and data structure definitions). ‘Car’ is an example of a class. It describes what it is like to be a car but it isn't actually a car itself. To make a ‘real’ car you have to instantiate the class, and then you get an object such as Julie's car which is a green Ford or Fred's car which is a red Toyota.
The difference between object and class is like the difference between a car and its technical manual. The manual tells you everything you need to know about the car so that you can even go and build one, but you'll look pretty silly sitting in the manual and expecting it to transport you from your home to a store.
In an object-oriented system, instances of a class could be made from several different sources (i.e. object factories). However, in many circumstances, it may be desirable to distinguish instances made by a specific source from those made by other sources. For example, a system might wish to know if an object's state was initialized from a production database or from some other data source, such as, for example, a test driver, before processing that object. There may be many reasons why a system may wish to know this information ranging from security reasons, such as concerns over computer viruses, to simply knowing that the instance was made by a source specifically designed for this application. Therefore, it would be desirable to have a method, system, and computer program product that allows system components to be able to distinguish between object instances constructed by designated factories from instances create by other factories. That is, the “unapproved” factories cannot forge an object instance that appears to have been constructed by an “approved” factory.